#include<bits/stdc++.h>
using namespace std;
string s;
stack<int> num;
stack<char> op;
void eval() {
  auto b=num.top();num.pop();
  auto a=num.top();num.pop();
  auto c=op.top();op.pop();
  int ans;
  switch(c) {
    case '+':
      ans=a+b; break;
    case '-':
      ans=a-b; break;
    case '*':
      ans=a*b; break;
    case '/':
      ans=a/b; break;
  }
  num.push(ans);
}

int main() {
  cin>>s;
  unordered_map<char, int> pr {{'+',1},{'-',1},{'*',2},{'/', 2}};
  int i=0;
  while(i<s.size()) {
    if(isdigit(s[i])) {
      int x = 0;
      int j;
      for(j=i; j<s.size() && isdigit(s[j]); ++j) {
        x*=10; x += s[j]-'0';
      }
      i = j;
      num.push(x);
    }
    else if(s[i]=='(') {
      op.push(s[i]);
      i++;
    }
    else if(s[i]==')') {
      while(op.top()!='(') eval();
      op.pop();
      i++;
    }
    else {
      while(op.size() && op.top()!='(' && pr[op.top()]>=pr[s[i]])
        eval();
      op.push(s[i]);
      i++;
    }
  }
  while(op.size()) eval();
  cout<<num.top()<<endl;
}

